#include "includes.h"


// dummy initialization and cleanup functions
int s1_init()
{
    // ****** TODO ******
    return 0;
}

int s1_cleanup()
{
    // ****** TODO ******
    return 0;
}


int s2_init()
{
    // ****** TODO ******
    return 0;
}

int s2_cleanup()
{
    // ****** TODO ******
    return 0;
}

// GSL random number generator
// gsl_rng *rng;


int main(int argc, char const *argv[])
{

    // unsigned int gslRandomSeed = 1;
    // read(open("/dev/urandom", O_RDONLY), &gslRandomSeed, sizeof(gslRandomSeed));
    
    // rng = rng_setup(gslRandomSeed);
    srand(time(0));

    if (CU_initialize_registry() != CUE_SUCCESS)
    {
        perror("Failed to initialize test registry\n");
    };


    // Register tests and suites

    CU_TestInfo tests1[] =
    {
        {"testCompare", test_compare},
        {"test_getCost", test_getCost},
        {"test_newGame", test_newGame},
        {"test_initializeGame", test_initializeGame},
        {"test_isGameOver", test_isGameOver},
        {"test_kingdomCards", test_kingdomCards},
        {"test_whoseTurn", test_whoseTurn},
        {"test_numHandCards", test_numHandCards},
        {"test_playCard", test_playCard},
        {"test_buyCard", test_buyCard},
        {"test_cardEffect", test_cardEffect},
        {"test_drawCard", test_drawCard},
        {"test_handCard", test_handCard},
        {"test_shuffle", test_shuffle},
        {"test_discardCard", test_discardCard},
        {"test_endTurn", test_endTurn},
        {"test_fullDeckCount", test_fullDeckCount},
        {"test_scoreFor", test_scoreFor},
        {"test_supplyCount", test_supplyCount},
        {"test_updateCoins", test_updateCoins},
        {"test_gainCard", test_gainCard},
        CU_TEST_INFO_NULL
    };

    CU_TestInfo tests2[] =
    {
        {"test_adventurer1", test_adventurer1},
        {"test_adventurer2", test_adventurer2},
        {"test_ambassador1", test_ambassador1},
        {"test_ambassador2", test_ambassador2},
        {"test_ambassador3", test_ambassador3},
        {"test_ambassador4", test_ambassador4},
        {"test_ambassador5", test_ambassador5},
        {"test_ambassador6", test_ambassador6},
        {"test_ambassador7", test_ambassador7},
        {"test_ambassador8", test_ambassador8},
        {"test_ambassador9", test_ambassador9},
        {"test_baron1", test_baron1},
        {"test_baron2", test_baron2},
        {"test_baron3", test_baron3},
        {"test_baron4", test_baron4},
        {"test_baron5", test_baron5},
        {"test_baron6", test_baron6},
        {"test_council_room", test_council_room},
        {"test_cutpurse1", test_cutpurse1},
        {"test_cutpurse2", test_cutpurse2},
        {"test_embargo1", test_embargo1},
        {"test_embargo2", test_embargo2},
        {"test_feast1", test_feast1},
        {"test_feast2", test_feast2},
        {"test_feast3", test_feast3},
        {"test_feast4", test_feast4},
        {"test_feast5", test_feast5},
        {"test_gardens", test_gardens},
        {"test_great_hall", test_great_hall},
        {"test_mine1", test_mine1},
        {"test_mine2", test_mine2},
        {"test_mine3", test_mine3},
        {"test_mine4", test_mine4},
        {"test_mine5", test_mine5},
        {"test_mine6", test_mine6},
        {"test_mine7", test_mine7},
        {"test_mine8", test_mine8},
        {"test_mine9", test_mine9},
        {"test_mine10", test_mine10},
        {"test_mine11", test_mine11},
        {"test_mine12", test_mine12},
        {"test_mine13", test_mine13},
        {"test_mine14", test_mine14},
        {"test_minion1", test_minion1},
        {"test_minion2", test_minion2},
        {"test_minion3", test_minion3},
        {"test_outpost", test_outpost},
        {"test_remodel1", test_remodel1},
        {"test_remodel2", test_remodel2},
        {"test_remodel3", test_remodel3},
        {"test_remodel4", test_remodel4},
        {"test_remodel5", test_remodel5},
        {"test_salvager", test_salvager},
        {"test_sea_hag", test_sea_hag},
        {"test_smithy", test_smithy},
        {"test_steward1", test_steward1},
        {"test_steward2", test_steward2},
        {"test_steward3", test_steward3},
        {"test_treasure_map1", test_treasure_map1},
        {"test_treasure_map2", test_treasure_map2},
        {"test_tribute1", test_tribute1},
        {"test_tribute2", test_tribute2},
        {"test_tribute3", test_tribute3},
        {"test_tribute4", test_tribute4},
        {"test_tribute5", test_tribute5},
        {"test_village", test_village},
        CU_TEST_INFO_NULL
    };

    CU_SuiteInfo suites[] =
    {
        { "suite1", s1_init, s1_cleanup, tests1 },
        { "suite2", s2_init, s2_cleanup, tests2 },

        CU_SUITE_INFO_NULL
    };

    if (CU_register_suites(suites) != CUE_SUCCESS)
    {
        perror("Failed to register test suites\n");
    };


    // Run the tests

    // CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_set_mode(CU_BRM_NORMAL);
    // CU_basic_set_mode(CU_BRM_SILENT);

    if (CU_basic_run_tests() != CUE_SUCCESS)
    {
        perror("Test run failed\n");
    }

    // CU_console_run_tests();

    // Use automated test to get XML output
    // If the .dtd and .xsl files from /usr/share/CUnit are copied to the
    // directory where this file is, Firefox will show the test results
    // from the XML files with color-coding
    
    // CU_automated_run_tests();
    // CU_list_tests_to_file();




    CU_cleanup_registry();
    return 0;

}
